package com.buer.train.business.service.impl;

import com.buer.train.business.dao.UserRoleDao;
import com.buer.train.business.domain.UserRoleDO;
import com.buer.train.business.service.UserRoleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class UserRoleServiceImpl implements UserRoleService {
	@Autowired
	private UserRoleDao userRoleDao;
	
	@Override
	public UserRoleDO get(Integer id){
		return userRoleDao.get(id);
	}
	
	@Override
	public List<UserRoleDO> list(Map<String, Object> map){
		return userRoleDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return userRoleDao.count(map);
	}
	
	@Override
	public int save(UserRoleDO userRole){
		return userRoleDao.save(userRole);
	}
	
	@Override
	public int update(UserRoleDO userRole){
		return userRoleDao.update(userRole);
	}
	
	@Override
	public int remove(Integer id){
		return userRoleDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return userRoleDao.batchRemove(ids);
	}

    @Override
    public PageInfo<UserRoleDO> getUserRoleList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<UserRoleDO> list = userRoleDao.getUserRoleList(map); // 获取数据
        PageInfo<UserRoleDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public UserRoleDO getOne(Map<String, Object> map){
        return userRoleDao.getOne(map);
    }

	@Override
	public int removeByUserId(Integer userId) {
		return userRoleDao.removeByUserId(userId);
	}

}
